﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml.Controls;

namespace BluewaterSoft.Notepad
{
  internal class ButtonDisabler : IDisposable
  {
    private Button _button;

    public ButtonDisabler(Button button)
    {
      this._button = button;
      this._button.IsEnabled = false;
    }

    public static ButtonDisabler Start(Button button)
    {
      return (new ButtonDisabler(button));
    }


    public void Dispose()
    {
      if (this._button != null)
        this._button.IsEnabled = true;
    }
  }
}
